package router

import (
	"awesomeProject/user-web/api"
	"awesomeProject/user-web/middlewares"
	"github.com/gin-gonic/gin"
)

func InitUserRouter(Router *gin.RouterGroup) {
	UserRouter := Router.Group("user").Use(middlewares.Trace())
	{
		// 参数JWTAuth()表示需要进行登录验证用户，IsAdminAuth()用户是否是管理员
		// 过程 外部请求 -> gin框架 -> 进行调用{JWTAuth() -> IsAdminAuth() -> api.GetUserList()} -> 进入后端
		UserRouter.GET("list", middlewares.JWTAuth(), middlewares.IsAdminAuth(), api.GetUserList)
		UserRouter.POST("pwd_login", api.PassWordLogin)
		UserRouter.POST("register", api.Register)
	}

}
